/*
 * @Author: Setsuna
 * @Email: 601890383@qq.com
 * @FilePath: \src\pages\QuotaManage\QuotaAdjust\component\FreezeForm.tsx
 * @Date: 2021-09-27 15:30:46
 * @LastEditTime: 2022-03-03 20:41:04
 */
import React, {  } from 'react'
import { IUdFormItem, UdModalForm, validators } from '@/lib'
import UdSelect from '@/components/UdFormControls/UdSelect'
import UdUploader from '@/components/UdUploader/Uploader'
import { Input} from 'antd'
import { WrappedFormUtils } from 'antd/lib/form/Form'
import './quotaModal.scss'
const { TextArea } = Input;

interface IProps {
    values: any
}
interface IState {
    values: any
}
export default class FreezeForm extends React.Component<IProps, IState> {
  private form: WrappedFormUtils
  private reasonList = [
    { title: '请选择冻结原因', value: '' },
    { title: '暂停发货', value: 'pause' },
    { title: '违规', value: 'rule' },
    { title: '其它', value: 'other' },
  ]
  private items: IUdFormItem[] = [
    { label: '品牌公司', id: 'brandName', render: () => <Input readOnly /> },
    { label: '配额品项', id: 'productGroupName', render: () => <Input readOnly /> },
    { label: '客户名称', id: 'dealerName', render: () => <Input readOnly /> },
    { label: '考核年度', id: 'year', render: () => <Input readOnly /> },
    { label: '申请类型', id: 'actionType', render: <Input readOnly /> },
    { label: '原因', id: 'actionReason', rules: [validators.required], render: <UdSelect options={this.reasonList} /> },
    {
      label: '备注信息',
      id: 'actionRemark',
      rules: [validators.required],
      render: <TextArea rows={3} maxLength={200} />,
    },
    { label: '凭证附件', id: 'files', render: <UdUploader extra="支持扩展名：.jpg .png" /> },
  ]
  constructor(props: IProps, state: IState) {
    super(props)
    this.state = {
      values: Object.assign({}, this.props.values),
    }
  }
  componentDidMount() {}
  private onOk = () => {
    console.log('submit')
    this.form.validateFields((err, values) => {
      if (!err) {
        console.log(values)
      } else {
        console.log(err)
      }
    })
  }
  render() {
    return <UdModalForm getForm={form => (this.form = form)} items={this.items} values={this.state.values} />
  }
}